﻿   //Ajax异步提交
   //var XmlHttp=new ActiveXObject("Microsoft.XMLhttp");
   var XmlHttp;
   var news_div;

   function createXMLHttp() 
	{
		if (window.ActiveXObject) {
			XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		else if (window.XMLHttpRequest) {
			XmlHttp = new XMLHttpRequest();
		}
	}

   function NewsAJAX(id)
   {
	createXMLHttp(); 
    news_div=id;
    XmlHttp.open("POST","http://www.3g.cn/server/GetTopNews.aspx",true);
    XmlHttp.send(null);
    XmlHttp.onreadystatechange=getnewsJsons;
   }
    
    //回调函数
    function getnewsJsons()
    {

        if (XmlHttp.readyState==4 || XmlHttp.readyState=='complete')
        {
              //alert(XmlHttp.responsetext);
             //document.getElementById("lbMsg").innerHTML =XmlHttp.responsetext;

             if(XmlHttp.responseText!="")
             {
                var content;
                var result="";
                
                
                content=eval(XmlHttp.responseText); //

				result+="	<div>";
				result+="		<div class=\"news_more\"><a href=\"/Content/YCNewsList/7/1/YCNewsList.shtml\">更多</a> <img src=\"images/more.gif\" /></div>";
				result+="		<img src=\"UploadImages/title/yc_a.gif\" alt=\"原创报道\" />";
				result+="	</div>";


				//result="<img src=\"UploadImages/title/yc_a.gif\" alt=\"原创报道\" />"
                result+="<ul>";
			    for(var i=0;i<content.length;i++)
			    {
				    //result+="<li><a href=\"/Content/YCNewsInfo.aspx?cid="+content[i].ChannelID+"&nid="+content[i].Id +"\">"+content[i].Title+"</a></li>";
					result+="<li><a href=\"/Content/YCNewsInfo/"+content[i].ChannelID + "/" + content[i].Id + "/YCNewsInfo.shtml \" target=\"_blank\">"+content[i].Title+"</a></li>";	//?cid="+content[i].ChannelID+"&nid="+content[i].Id +"\">"+content[i].Title+"</a></li>";
			    }
				result+="</ul>";
				//result+="<div><a href=\"/Content/YCNewsList.aspx\">更多 >></a></div>";
    			//result+="<div><a href=\"/Content/YCNewsList/1/1/YCNewsList.html\">更多 >></a></div>";
		        document.getElementById(news_div).innerHTML = result;

             }  
			 else
			 {
			   document.getElementById(news_div).innerHTML = "加载中..."
			 }
        }
		else
		{
		   document.getElementById(news_div).innerHTML = "加载中..."
		}
    }